<script setup>
import { defineProps } from 'vue'
const props = defineProps({ menus: { type: Array, default: () => [] } })
</script>
<template>
  <template v-for="menu in menus" :key="menu.id">
    <el-sub-menu v-if="menu.children && menu.children.length" :index="menu.url || String(menu.id)">
      <template #title>
        <i class="el-icon-menu"></i>
        <span>{{ menu.name }}</span>
      </template>
      <MenuTree :menus="menu.children" />
    </el-sub-menu>
    <el-menu-item v-else :index="menu.url || String(menu.id)">
      <i class="el-icon-document"></i>
      <span>{{ menu.name }}</span>
    </el-menu-item>
  </template>
</template> 